package vn.dreamteam.vuigiaitri;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout.LayoutParams;
import android.widget.LinearLayout;

public class MainActivity extends Activity {
	/** Biến tham chiếu đến activity */
	private static MainActivity instance;
	/** Layout Nội dung */
	private LinearLayout layoutContent;

	private MenuMananger menuMananger;

	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		instance = this;
		setContentView(R.layout.activity_main);

		// Khởi tạo menu
		menuMananger = new MenuMananger();
		menuMananger.init();

		layoutContent = (LinearLayout) findViewById(R.id.content_frame);

	}

	/**
	 * Trả về tham chiếu duy nhất từ mọi class trong ứng dụng tới activity
	 */
	public static MainActivity getInstance() {
		return instance;
	}

	// Thêm trang trong nội dung
	public void addFrameContent(View view) {
		layoutContent.removeAllViews();
		LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
				LayoutParams.MATCH_PARENT);
		layoutContent.addView(view, layoutParams);
	}

}
